package springcloud.task;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import springcloud.service.IMoiveInfoService;

/**
 * @Author zhenyu
 * @desc
 * @Date 2022/10/18 9:23
 * @Version 1.0
 */
@Slf4j
@Configuration
@EnableScheduling
public class MyJob {

  @Autowired
  private IMoiveInfoService iMoiveInfoService;

  /**
   * 每天00：01更新redis数据
   */
  @Scheduled(cron = "${Cron.interfaceLimits}")
  private void initInterfaceLimitsRedisCache() {

    log.info("开始执行initInterfaceLimitsRedisCache");
    try {
      iMoiveInfoService.initInterfaceLimitsRedisCache();
    } catch (Exception e) {
      log.error(e.getMessage());
    }

  }
}